<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="assets/clock/css/style.css">
    <title>拟态时钟</title>
</head>
<body>
    <div class="container">
        <div class="box">
            <div class="clock">
                <div class="hour">
                    <div class="hr" id="hr"></div>
                </div>

                <div class="min">
                    <div class="mn" id="mn"></div>
                </div>

                <div class="sec">
                    <div class="sc" id="sc"></div>
                </div>
            </div>
        </div>
    </div>
    
    <script>
        const deg = 6;
        const hr = document.querySelector("#hr");
        const mn = document.querySelector("#mn");
        const sc = document.querySelector("#sc");
         
        setInterval(() => {
            let day = new Date();
            let hh = (day.getHours() % 12) * 30;
            let mm = (day.getMinutes() % 60) * deg;
            let ss = (day.getSeconds() % 60) * deg;
            
            hr.style.transform = `rotateZ(${hh+(mm/12.0)}deg)`;
            mn.style.transform = `rotateZ(${(mm+(ss/60.0))}deg)`;
            sc.style.transform = `rotateZ(${ss}deg)`;
        })
    </script>
</body>
</html>
